package com.android.takegism.utils;

import androidx.annotation.Nullable;

import java.util.HashSet;
import java.util.LinkedList;

public class HardPuzzle extends PuzzleAbstract{

    static {
        errorAnswers = new HashSet<>();
    }
    public HardPuzzle(@Nullable Clue clue) {
        super(clue);
    }

    @Override
    public Object check(Object answer) throws Exception {
        if (answer instanceof String){
            if (answer.equals(getAnswer())) {
                LinkedList<Clue> update_clues = (LinkedList<Clue>) MyContext.getInstance().getAllClues("update_clues");
                if(update_clues==null){
                    update_clues = new LinkedList<Clue>();
                }
                update_clues.add(clue);
                MyContext.getInstance().setAllClues("update_clues",update_clues);
                return clue.clue;
            }else{
                return null;
            }
        }
        throw new Exception("程序错误");
    }
}
